package com.ruoyi.system.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.SysWlyzUser;
import com.ruoyi.system.service.ISysWlyzUserService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 网络验证Controller
 * 
 * @author zhouchang
 * @date 2024-12-16
 */
@RestController
@RequestMapping("/system/wlyzuser")
public class SysWlyzUserController extends BaseController
{
    @Autowired
    private ISysWlyzUserService sysWlyzUserService;

    /**
     * 查询网络验证列表
     */
    @PreAuthorize("@ss.hasPermi('system:wlyzuser:list')")
    @GetMapping("/list")
    public TableDataInfo list(SysWlyzUser sysWlyzUser)
    {
        startPage();
        List<SysWlyzUser> list = sysWlyzUserService.selectSysWlyzUserList(sysWlyzUser);
        return getDataTable(list);
    }

    /**
     * 导出网络验证列表
     */
    @PreAuthorize("@ss.hasPermi('system:wlyzuser:export')")
    @Log(title = "网络验证", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, SysWlyzUser sysWlyzUser)
    {
        List<SysWlyzUser> list = sysWlyzUserService.selectSysWlyzUserList(sysWlyzUser);
        ExcelUtil<SysWlyzUser> util = new ExcelUtil<SysWlyzUser>(SysWlyzUser.class);
        util.exportExcel(response, list, "网络验证数据");
    }

    /**
     * 获取网络验证详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:wlyzuser:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(sysWlyzUserService.selectSysWlyzUserById(id));
    }

    /**
     * 新增网络验证
     */
    @PreAuthorize("@ss.hasPermi('system:wlyzuser:add')")
    @Log(title = "网络验证", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody SysWlyzUser sysWlyzUser)
    {
        return toAjax(sysWlyzUserService.insertSysWlyzUser(sysWlyzUser));
    }

    /**
     * 修改网络验证
     */
    @PreAuthorize("@ss.hasPermi('system:wlyzuser:edit')")
    @Log(title = "网络验证", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody SysWlyzUser sysWlyzUser)
    {
        return toAjax(sysWlyzUserService.updateSysWlyzUser(sysWlyzUser));
    }

    /**
     * 删除网络验证
     */
    @PreAuthorize("@ss.hasPermi('system:wlyzuser:remove')")
    @Log(title = "网络验证", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(sysWlyzUserService.deleteSysWlyzUserByIds(ids));
    }
}
